package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.base.model.BaseEntity;
import com.atguigu.gmall.product.model.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 品牌表 业务实现类
 *
 * @author atguigu
 * @since 2023-04-18
 */
@Service
public class BaseTrademarkServiceImpl extends ServiceImpl<BaseTrademarkMapper, BaseTrademark> implements BaseTrademarkService {

    /**
     * 品牌列表分页查询
     *
     * @param iPage 分页对象
     * @return
     */
    @Override
    public IPage<BaseTrademark> getBaseTrademarkList(IPage<BaseTrademark> iPage) {
        //1.使用入参中分页对象
        //2.构建排序条件
        LambdaQueryWrapper<BaseTrademark> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(BaseEntity::getUpdateTime);
        //3.调用公共业务层分页方法完成查询
        return this.page(iPage, queryWrapper);
    }
}
